#!/bin/sh

set -e

if [ "$1" = "install" ] && [ -e /etc/X11/gdm/PostSession/Default.pre-fsck2.backup ] ; then
    rm /etc/X11/gdm/PostSession/AutoFsck
    rm /etc/X11/gdm/PostSession/Default.pre-fsck2.backup
    sed -e "/AutoFsck/d" -i /etc/X11/gdm/PostSession/Default
    chmod a+x /etc/X11/gdm/PostSession/Default
fi

if [ "$1" = "upgrade" ] ; then
    if [ -e /etc/gdm/PostSession/Default ] ; then
        sed -e "/^# Start-AutoFsck/,/^# End-AutoFsck/d" -i /etc/gdm/PostSession/Default
    fi
    if [ -e /etc/kde3/kdm/Xreset ] ; then
        sed -e "/^# Start-AutoFsck/,/^# End-AutoFsck/d" -i /etc/kde3/kdm/Xreset
    fi
    rm /etc/rc0.d/S85autofsck
fi

exit 0
